/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ru.ipccenter.resource;

import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.regex.PatternSyntaxException;

/**
 *
 * @author Mari
 */

/*
 * Firstly, you try applying resultMainExactQuery and if nothing is found , will try resultMainRegExp
 * 
 */
public class UserQuery {   
   public static boolean isRegExp(String query){
       try{
           Pattern word = Pattern.compile("(\\w*\\s*\\w*)*");
           Matcher mch = word.matcher(query);
           if(mch.matches()){return false;}
           else {
               Pattern ptr = Pattern.compile(query);
               return true;
           }
       }       
       catch(PatternSyntaxException e){
           return false;
       }
   }    
   public static void main(String[] args){
       UserQuery u = new UserQuery();
       System.out.println(u.isRegExp("\\[a\\-z"));
   }
}
